<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JavaScript入门案例</title>
    <script type="text/javascript">
        window.onload = function(){
        var btn = document.getElementById("btn");
        btn.onclick = function () {
            alert("hello")

        };
        };
    </script>
</head>
<body>
<input type="button" value="点击" id="btn">
</body>
</html>